Hello DXL Developers,
I'm New DXL. I would like to know how to "pass arguments to a DXL" from a c# file
In the below code, I want to pass Arg1 and Arg2 to the DXL file and to access it within DXL. But I dono how to set the arguments and to get in DXL file. doors.runFile("Arg 1 Arg2 C:\\Desktop\\retreive.dxl");
Team your response will be really helpful. P.S I'm working on Doors 9.x Thanks in advance
Best Regards, Nabil Saleem maknabil - Fri Oct 09 05:29:02 EDT 2015 |
Re: Retreive Argument within DXL If you use the runStr perm, you can pass a string containing the arguments and an include file containing the file with the code in that's the way I do it anyway Note that I don't have an example to hand so the escaping of the quotes might be wrong, but you need something like
doors.runStr("#include<C:\\Desktop\\Retrieve.dxl>\\n" + "MainFunction(" + arg1 + "," + arg2 + ")") |
Re: Retreive Argument within DXL Richard_Good - Fri Oct 09 08:01:27 EDT 2015 If you use the runStr perm, you can pass a string containing the arguments and an include file containing the file with the code in that's the way I do it anyway Note that I don't have an example to hand so the escaping of the quotes might be wrong, but you need something like
doors.runStr("#include<C:\\Desktop\\Retrieve.dxl>\\n" + "MainFunction(" + arg1 + "," + arg2 + ")") thanks Richard :)
It helped a lot.
But when i pass an xml as string argument it is not working. Any clue?? P.S I throw the string in a message box it is working. but it is not taken by runStr. And it throws some error like this
-E- DXL: <Line:2> syntax error
Code:
string xmlString = "(NLS_(\"<Object> \\n <Attributes Heading = \\\"\")) o.(NLS_(\"Object Heading\"))(NLS_(\"\\\"\"))(NLS_(\" \"))(NLS_(\"ShortText = \\\"\")) o.(NLS_(\"Object Short Text\"))(NLS_(\"\\\"\"))(NLS_(\" \"))(NLS_(\"LongText = \\\"\")) o.(NLS_(\"Object Text\"))(NLS_(\"\\\"\"))(NLS_(\" \"))(NLS_(\"AbsoluteNumber = \\\"\")) o.(NLS_(\"Absolute Number\"))(NLS_(\"\\\"\"))(NLS_(\" \"))(NLS_(\"EAGUID = \\\"\")) o.(NLS_(\"EAGUID\"))(NLS_(\"\\\"\"))(NLS_(\" \"))(NLS_(\"ObjectNumber = \\\"\")) (NLS_(ObjNum))(NLS_(\"\\\"\"))(NLS_(\" \"))(NLS_(\"CreatedBy = \\\"\")) o.(NLS_(\"Created By\"))(NLS_(\"\\\"\"))(NLS_(\" \"))(NLS_(\"CreatedOn = \\\"\")) o.(NLS_(\"Created On\"))(NLS_(\"\\\"\"))(NLS_(\" \"))(NLS_(\"LastModifiedOn = \\\"\")) o.(NLS_(\"Last Modified On\"))(NLS_(\"\\\"\"))(NLS_(\" \"))(NLS_(\"/>\"))(NLS_(\"\\n\"))(NLS_(\"</Object> \\n\"))"; MessageBox.Show(xmlString); doors.runStr("#include <C:\\Users\\nabil\\Desktop\\doors\\retreiveReqDXL.dxl>\n string sXmlString = \"" + xmlString + "\"\n mainFunction(sXmlString)");
|
Re: Retreive Argument within DXL maknabil - Tue Oct 13 10:03:16 EDT 2015 thanks Richard :)
It helped a lot.
But when i pass an xml as string argument it is not working. Any clue?? P.S I throw the string in a message box it is working. but it is not taken by runStr. And it throws some error like this
-E- DXL: <Line:2> syntax error
Code:
string xmlString = "(NLS_(\"<Object> \\n <Attributes Heading = \\\"\")) o.(NLS_(\"Object Heading\"))(NLS_(\"\\\"\"))(NLS_(\" \"))(NLS_(\"ShortText = \\\"\")) o.(NLS_(\"Object Short Text\"))(NLS_(\"\\\"\"))(NLS_(\" \"))(NLS_(\"LongText = \\\"\")) o.(NLS_(\"Object Text\"))(NLS_(\"\\\"\"))(NLS_(\" \"))(NLS_(\"AbsoluteNumber = \\\"\")) o.(NLS_(\"Absolute Number\"))(NLS_(\"\\\"\"))(NLS_(\" \"))(NLS_(\"EAGUID = \\\"\")) o.(NLS_(\"EAGUID\"))(NLS_(\"\\\"\"))(NLS_(\" \"))(NLS_(\"ObjectNumber = \\\"\")) (NLS_(ObjNum))(NLS_(\"\\\"\"))(NLS_(\" \"))(NLS_(\"CreatedBy = \\\"\")) o.(NLS_(\"Created By\"))(NLS_(\"\\\"\"))(NLS_(\" \"))(NLS_(\"CreatedOn = \\\"\")) o.(NLS_(\"Created On\"))(NLS_(\"\\\"\"))(NLS_(\" \"))(NLS_(\"LastModifiedOn = \\\"\")) o.(NLS_(\"Last Modified On\"))(NLS_(\"\\\"\"))(NLS_(\" \"))(NLS_(\"/>\"))(NLS_(\"\\n\"))(NLS_(\"</Object> \\n\"))"; MessageBox.Show(xmlString); doors.runStr("#include <C:\\Users\\nabil\\Desktop\\doors\\retreiveReqDXL.dxl>\n string sXmlString = \"" + xmlString + "\"\n mainFunction(sXmlString)");
Not sure what you are trying to do with the string. Easier to read it from the file system rather than mess about escaping quotes. so in this case get your c# program to write the file to eg. c:\\temp\\Nabil.xml then use something like: - string xmlString = readFile(c:\\temp\\Nabil.xml) in the dxl string you pass Note if you are making a call for each object you create, adding lines like: - string myHeading = "This heading" string mObj = "This Req" and adding them to the dxl string may be simpler than using a xml file as you don't have to decode it, depends on your complexity. |
Re: Retreive Argument within DXL Richard_Good - Fri Oct 09 08:01:27 EDT 2015 If you use the runStr perm, you can pass a string containing the arguments and an include file containing the file with the code in that's the way I do it anyway Note that I don't have an example to hand so the escaping of the quotes might be wrong, but you need something like
doors.runStr("#include<C:\\Desktop\\Retrieve.dxl>\\n" + "MainFunction(" + arg1 + "," + arg2 + ")") Thanks Richard this worked. doors.runStr("#include <C:\\Users\\nabil\\Desktop\\doors\\getAttrsList.dxl>\n string sConcPath =\"" + sProjectModConcPath + "\"\n string sXmlPath =\"" + AttrListXmlPath + "\"\n mainProgram(sConcPath,sXmlPath)");
Is there a way to find an attribute is read only or not? In My DXL code
AttrDef ad for ad in sourceMod do
ack ad.name ack ad.typeName returns attribute "Name" and its type "String" I would like to know is that a read-only attribute like(Created By, Absolute Number)
Best Regards, Nabil
|
Re: Retreive Argument within DXL maknabil - Wed Nov 04 01:58:10 EST 2015 Thanks Richard this worked. doors.runStr("#include <C:\\Users\\nabil\\Desktop\\doors\\getAttrsList.dxl>\n string sConcPath =\"" + sProjectModConcPath + "\"\n string sXmlPath =\"" + AttrListXmlPath + "\"\n mainProgram(sConcPath,sXmlPath)");
Is there a way to find an attribute is read only or not? In My DXL code
AttrDef ad for ad in sourceMod do
ack ad.name ack ad.typeName returns attribute "Name" and its type "String" I would like to know is that a read-only attribute like(Created By, Absolute Number)
Best Regards, Nabil
found it ad.useraccess |